package entitys

import (
	"time"

	"github.com/jinzhu/gorm"
)

type SysRole struct {
	EntityInfo
	Id          int32  `gorm:"primary_key" json:"roleId"`
	RoleName    string `json:"roleName"`
	Alias       string `json:"alias"`
	Description string `json:"description"`
	IsDel       int    `json:"isDel"`
}

func (SysRole) TableName() string {
	return "sys_role"
}

func (sysRole *SysRole) BeforeCreate(scope *gorm.Scope) error {
	err := scope.SetColumn("CreaDtt", time.Now())
	err = scope.SetColumn("UptDtt", time.Now())
	return err
}

func (sysRole *SysRole) BeforeUpdate(scope *gorm.Scope) error {
	err := scope.SetColumn("UptDtt", time.Now())
	return err
}
